﻿@{
    ViewBag.Title = "Login";
}

<h2>千百意花卉后台管理</h2>
<script src="~/lib/jquery/1.9.1/jquery.min.js"></script>


<!DOCTYPE html>
<html>
<head>
    <meta charset="utf-8">
    <meta name="renderer" content="webkit|ie-comp|ie-stand">
    <meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1">
    <meta name="viewport" content="width=device-width,initial-scale=1,minimum-scale=1.0,maximum-scale=1.0,user-scalable=no" />
    <meta http-equiv="Cache-Control" content="no-siteapp" />
    <link href="~/static/h-ui/css/H-ui.min.css" rel="stylesheet" />
    <link href="~/static/h-ui.admin/css/H-ui.login.css" rel="stylesheet" />
    <link href="~/static/h-ui.admin/css/style.css" rel="stylesheet" />
    <link href="~/lib/Hui-iconfont/1.0.8/iconfont.css" rel="stylesheet" />
    <title>千百意花卉后台管理</title>
    
</head>
<body>

   
    <div class="loginWraper">
        <h2 style="text-align:center;margin-top:30px;">千百意花卉登录页面</h2>
        <div id="loginform" class="loginBox">

            <form class="form form-horizontal" action="index.html" method="post">
                <div class="row cl">
                    <label class="form-label col-xs-2"><i class="Hui-iconfont">&#xe60d;</i></label>
                    <div class="formControls col-xs-10">
                        <input id="tel" name="name" type="text" placeholder="手机号码" class="input-text size-L"><span id="s1" style="color:red"></span>
                    </div>
                </div>
                <div class="row cl">
                    <label class="form-label col-xs-2"><i class="Hui-iconfont">&#xe60e;</i></label>
                    <div class="formControls col-xs-10">
                        <input id="Pwd" name="pwd" type="password" placeholder="密码" class="input-text size-L"><span id="s2" style="color:red"></span>
                    </div>
                </div>
                <div class="row cl">
                    <div class="formControls col-xs-10 col-xs-offset-2">
                        <input id="yzm" class="input-text size-L" type="text" placeholder="验证码" onblur="if(this.value==''){this.value='验证码:'}" onclick="if(this.value=='验证码:'){this.value='';}" value="验证码:" style="width:150px;"><span id="s3" style="color:red"></span>
                        <img src="~/validte.ashx" style="height:40px;width:80px;" onclick="this.src = '/validte.ashx?d='+new Date()"> <a id="kanbuq" href="">看不清，换一张</a>
                    </div>
                </div>
               

                <div class="row cl">
                    <div class="formControls col-xs-8 col-xs-offset-3">                       
                     
                    </div>
                </div>
                <div class="row cl">
                    <div class="formControls col-xs-8 col-xs-offset-3">
                        <input name="" type="button" class="btn btn-success radius size-L" value="&nbsp;登&nbsp;&nbsp;&nbsp;&nbsp;录&nbsp;" onclick="login()">
                        &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;

                        <input name="" type="button" class="btn btn-success radius size-L" value="&nbsp;注&nbsp;&nbsp;&nbsp;&nbsp;册&nbsp;" onclick="location.href='/home/register'">

                    </div>
                </div>
            </form>
        </div>
    </div>

    <script type="text/javascript" src="lib/jquery/1.9.1/jquery.min.js"></script>
    <script type="text/javascript" src="static/h-ui/js/H-ui.min.js"></script>
    <!--此乃百度统计代码，请自行删除-->
    <script>
 
        //登录
        function login() {
            var tel = $("#tel").val();
            var pwd = $("#Pwd").val();
            var yzm = $("#yzm").val();
            var myreg = /^1(3|4|5|7|8)\d{9}$/;

            if (tel == "" || tel == null) {
                $("#s1").html("手机号不能为空"); return;
            } else {
                $("#s1").html("");
            }
            if (!myreg.test(tel)) {
                $("#s1").html("手机号格式不正确"); return;
            }
            else {
                $("#s1").html("");
            }
            if (pwd == "" || pwd == null) {
                $("#s2").html("密码不能为空"); return;
            } else {
                $("#s2").html("");
            }
            if (yzm == "" || yzm == null) {
                $("#s3").html("验证码不能为空"); return;
            } else {
                $("#s3").html("");
            }

            $.ajax({
                type: "post",
                url: "/home/LoginDo",
                data: { tel: tel, pwd: pwd, yzm: yzm },
                success:function(obj)
                {
                    if (obj == 2)
                    {
                        alert("验证码不正确");
                        return;
                    }

                    if(obj>0)
                    {
                        alert("登录成功");
                        location.href = '/home/index'
                    } else {
                        alert("手机号或者密码错误");
                        location.reload();
                    }

                }

            })
        }
    </script>

</body>
</html>